﻿<UserControl x:Class="Reflection.Controls.TypesInfoControl"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:c="clr-namespace:Reflection.Controls"
			 mc:Ignorable="d"              
			 >
    <UserControl.Resources>
        <ResourceDictionary>
            <HierarchicalDataTemplate x:Key="HierarchialTypesInfoBasicDataTemplate">
                <c:TypesBasicInfoControl />
            </HierarchicalDataTemplate>
            <HierarchicalDataTemplate x:Key="HierarchialTypesInfoDataTemplate">
                <c:TypesInfoControl />
            </HierarchicalDataTemplate>
            <Style x:Key="TypesTreeViewItemStyle" TargetType="TreeViewItem">
                <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                <Setter Property="Template" Value="{StaticResource StretchTreeViewItemControlTemplate}" />
                <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
                <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />                
            </Style>
            <Style x:Key="TypesTreeViewStyle" TargetType="TreeView">
                <Setter Property="Focusable" Value="False" />
                <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
                <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
                <Setter Property="ItemContainerStyle" Value="{StaticResource TypesTreeViewItemStyle}" />                                
            </Style>

            <Style x:Key="AllBaseClassesTreeViewStyle" TargetType="TreeView" BasedOn="{StaticResource TypesTreeViewStyle}">
                <Setter Property="ItemsSource" Value="{Binding AllBaseClasses}" />
                <Setter Property="ItemTemplate" Value="{StaticResource HierarchialTypesInfoBasicDataTemplate}" />
            </Style>
            <Style x:Key="InterfacesTreeViewStyle" TargetType="TreeView" BasedOn="{StaticResource TypesTreeViewStyle}">
                <Setter Property="ItemsSource" Value="{Binding AllInterfaces}" />
                <Setter Property="ItemTemplate" Value="{StaticResource HierarchialTypesInfoDataTemplate}" />
            </Style>
            
            <Style x:Key="SectionExpanderStyle" TargetType="Expander">
                <Setter Property="IsExpanded" Value="False" />
                <Setter Property="MaxHeight" Value="150pt" />
            </Style>
            
        </ResourceDictionary>
    </UserControl.Resources>
    <ScrollViewer>
        <StackPanel Orientation="Vertical">
            <c:TypesBasicInfoControl />
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Expander Grid.Row="0" Grid.Column="0" Header="Base classes" Style="{StaticResource SectionExpanderStyle}">
                    <TreeView Style="{StaticResource AllBaseClassesTreeViewStyle}" />
                </Expander>
                <Expander Grid.Row="0" Grid.Column="1" Header="Interfaces" Style="{StaticResource SectionExpanderStyle}">
                    <TreeView Style="{StaticResource InterfacesTreeViewStyle}" />
                </Expander>
            
                <Expander Grid.Row="1" Grid.Column="0" Header="Constructors" Style="{StaticResource SectionExpanderStyle}">
                    <ListBox ItemsSource="{Binding AllConstructors}" />
                </Expander>
                <Expander Grid.Row="1" Grid.Column="1" Header="Events" Style="{StaticResource SectionExpanderStyle}">
                    <ListBox ItemsSource="{Binding AllEvents}" />
                </Expander>

                <Expander Grid.Row="2" Grid.Column="0" Header="Fields" Style="{StaticResource SectionExpanderStyle}">
                    <ListBox ItemsSource="{Binding AllFields}" />
                </Expander>
                <Expander Grid.Row="2" Grid.Column="1" Header="Properties" Style="{StaticResource SectionExpanderStyle}">
                    <ListBox ItemsSource="{Binding AllProperties}" />                    
                </Expander>

                <Expander Grid.Row="3" Grid.Column="0" Header="Methods" Style="{StaticResource SectionExpanderStyle}">
                    <ListBox ItemsSource="{Binding AllMethods}" />
                </Expander>
            </Grid>
        </StackPanel>        
    </ScrollViewer>
</UserControl>
